<CFIF lPreProcessShowMsg EQ "Yes">
<table border=0 cellpadding="1px" cellspacing=0 width="100%">
</CFIF>
<CFQUERY NAME="qryECINCHECKVOUCHER" DATASOURCE=#client.company_dsn#>
	SELECT DOCNUMBER
	FROM ECINCHECKVOUCHER
	WHERE DOCNUMBER = '#Evaluate("GetEntry.DOCNUMBER")#'
</CFQUERY>
<CFQUERY NAME="qryCINACCENTRIES" DATASOURCE=#client.company_dsn#>
	SELECT *
	FROM CINACCENTRIES
	WHERE DOCNUMBER = '#qryECINCHECKVOUCHER.DOCNUMBER#'
</CFQUERY>

<CFOUTPUT>
	<CFIF NOT qryECINCHECKVOUCHER.RecordCount>
		<CFIF lPreProcessShowMsg EQ "Yes">
			<tr><td nowrap class="bold">Check Voucher with Doc No. #GetEntry.DOCNUMBER# missing.</td></tr>
		</CFIF>
	<CFELSEIF NOT qryCINACCENTRIES.RecordCount>
		<CFIF lPreProcessShowMsg EQ "Yes">
			<tr><td nowrap class="bold">Please input data in the infocards.</td></tr>
		</CFIF>
	<CFELSE>
		<CFSET DEBITTOTAL=0>
		<CFSET CREDITTOTAL=0>
		<CFLOOP QUERY="qryCINACCENTRIES">
			<CFSET DEBITTOTAL=DEBITTOTAL + #DEBITAMOUNT#>
			<CFSET CREDITTOTAL=CREDITTOTAL + #CREDITAMOUNT#>
		</CFLOOP>
		<CFIF DEBITTOTAL EQ 0 AND CREDITTOTAL EQ 0>
			<CFIF lPreProcessShowMsg EQ "Yes">
				<tr><td nowrap class="bold">Total Debits and Total Credits is Zero (0).</td></tr>
			</CFIF>
		<CFELSEIF (DEBITTOTAL GT CREDITTOTAL) OR (CREDITTOTAL GT DEBITTOTAL)>
			<CFIF lPreProcessShowMsg EQ "Yes">
				<tr><td nowrap class="bold">Total Debits and Total Credits are not Balance.</td></tr>
			</CFIF>
		<CFELSEIF (DEBITTOTAL EQ CREDITTOTAL)>
			<CFSET lPreProcessValidated="Yes">
		</CFIF>
				<tr>
					<td width="50%">
						<table border=0 cellpadding=2 cellspacing=0 width="100%">
						<tr>
							<td nowrap>Total Debit:&nbsp;</td>
							<td nowrap width="100%" class="bold">#DEBITTOTAL#</td>
						</tr>
						</table>
					</td>
					<td bgcolor="##808080"></td>
					<td width="50%">
						<table border=0 cellpadding=2 cellspacing=0 width="100%">
						<tr>
							<td nowrap>&nbsp;Total Credit:&nbsp;</td>
							<td nowrap width="100%" class="bold">#CREDITTOTAL#</td>
						</tr>
						</table>
					</td>
	</CFIF>
</CFOUTPUT>
<CFIF lPreProcessShowMsg EQ "Yes">
</table>
</CFIF>
